package mysql;

import com.google.common.base.Preconditions;
import common.MyToStringStyle;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * @ClassName MysqlPacket
 * @Description TODO
 * @Author fengk
 * @Date 2018/8/25
 */

public class MysqlPacket {
    public final static int PACKETHEADERLEN=4;
    protected MysqlPacketHeader mysqlPacketHeader;

    public MysqlPacketHeader getMysqlPacketHeader() {
        return mysqlPacketHeader;
    }

    public void setMysqlPacketHeader(MysqlPacketHeader mysqlPacketHeader) {
        Preconditions.checkNotNull(mysqlPacketHeader);
        this.mysqlPacketHeader = mysqlPacketHeader;
    }

    protected MysqlPacket(MysqlPacketHeader mysqlPacketHeader) {
        this.mysqlPacketHeader = mysqlPacketHeader;
    }

    protected MysqlPacket(){};

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, MyToStringStyle.DEFAULT_STYLE);
    }
}
